/************************************************************
* TABLE A12: Staff Compensation Imputing Education Information
*************************************************************/

* Panel A: House
clear
use masterdata_house1.dta
sort core_person_id
merge core_person_id using firstcong.dta
keep if _merge == 3
drop _merge
la var firstcong "congress staffer appeared first time in the data"
keep if firstcong >=108
gen exp = 2*(congress - firstcong +1) 
gen femalestaff = 0
replace femalestaff = 1 if gender =="F"
gen memfemale = 0
replace memfemale = 1 if minwomen + majwomen > 0
gen int1 = dem*femalestaff
gen int2 = dem*femalestaff*memfemale

* imputing missing educational background as BA degree 
gen grad_degree2 = 0
replace grad_degree2 = grad_degree if grad_degree == 1
gen jdphd2 = 0
replace jdphd2 = 1 if jdphd == 1

macro define member_char1 "dem memfemale majority chair subchr seniority maj_leader min_leader power"
macro define member_char2 "majority chair subchr seniority maj_leader min_leader power"
macro define staff_char1  "exp totworkdays rank nondc notfulltime"
macro define staff_char2  "exp totworkdays rank nondc notfulltime jdphd grad_degree"
macro define staff_char3  "exp totworkdays rank nondc notfulltime jdphd2  grad_degree2"

eststo clear
eststo: quietly areg salary femalestaff int1 int2 $member_char2 $staff_char1 i.congress, a(member_office_id) vce(cluster member_office_id)
eststo: quietly areg salary femalestaff int1 int2 $member_char2 $staff_char2 i.congress, a(member_office_id) vce(cluster member_office_id)
eststo: quietly areg salary femalestaff int1 int2 $member_char2 $staff_char3 i.congress, a(member_office_id) vce(cluster member_office_id)
esttab, star(* 0.05 ** 0.01 *** 0.001) drop(*congress*) se ar2
esttab using edu_imputed1_h.tex, star(* 0.05 ** 0.01 *** 0.001) se ar2 replace


* Panel B: Senate
clear
use masterdata_senate1.dta
sort core_person_id
merge core_person_id using firstcong.dta
keep if _merge == 3
drop _merge
gen exp = 2*(congress - firstcong +1) 
la var firstcong "congress staffer appeared first time in the data"
gen memfemale = 0
replace memfemale = 1 if minwomen ==1
replace memfemale = 1 if majwomen ==1
gen femalestaff = 0
replace femalestaff = 1 if gender =="F"
gen int1 = dem*femalestaff
gen int2 = dem*femalestaff*memfemale

* imputing missing educational background as BA degree 
gen grad_degree2 = 0
replace grad_degree2 = grad_degree if grad_degree == 1
gen jdphd2 = 0
replace jdphd2 = 1 if jdphd == 1

macro define member_char1 "dem memfemale majority chair subchr seniority maj_leader min_leader power up_for_reelection freshman"
macro define member_char2 "majority chair subchr seniority maj_leader min_leader power up_for_reelection freshman"
macro define staff_char1  "exp totworkdays rank nondc notfulltime"
macro define staff_char2  "exp totworkdays rank nondc notfulltime jdphd grad_degree"
macro define staff_char3  "exp totworkdays rank nondc notfulltime jdphd2  grad_degree2"

eststo clear
eststo: quietly areg salary femalestaff int1 int2 $member_char2 $staff_char1 i.congress, a(member_office_id) vce(cluster member_office_id)
eststo: quietly areg salary femalestaff int1 int2 $member_char2 $staff_char2 i.congress, a(member_office_id) vce(cluster member_office_id)
eststo: quietly areg salary femalestaff int1 int2 $member_char2 $staff_char3 i.congress, a(member_office_id) vce(cluster member_office_id)
esttab, star(* 0.05 ** 0.01 *** 0.001) drop(*congress*) se ar2
esttab using edu_imputed1_s.tex, star(* 0.05 ** 0.01 *** 0.001) se ar2 replace


